1. Field of the Invention
This invention relates to image activity in video compression.
2. Description of the Prior Art
In some previously proposed video compression systems, the image xe2x80x9cactivityxe2x80x9d is measured for blocks or regions of input images to be encoded. The activity values associated with the blocks are used to allocate available space in the compressed data stream, and therefore to control the degree of compression applied to each of the blocks.
The reason for the variation of the compression in dependence on the activity values is that compression artifacts and distortions are more subjectively disturbing in blocks of low activity or low detail content (such as a plain sky or background area) than in blocks of high detail content (such as an image of a tree or a rough surface). Broadly, then, the image activity measures the degree of detail within a block or region of the image. A highly detailed block will have a high image activity, and a block of low detail will have a low image activity.
In previously proposed video compression systems using the discrete cosine transform technique (DCT), blocks of pixels are frequency separated using the DCT process and each block is then subject to data quantisation with a dependence of the quantisation scale factor on the image activity of that block. In a DCT-based system, each image block is self-contained, so the degree of quantisation applied to one image block does not tend to affect the coding of an adjacent image block.
In contrast, in systems using for example the so-called wavelet encoding technique, the effects of a particular block of wavelet coefficients spread over surrounding blocks of image pixels when the image is subsequently reconstructed. This means that if there are sharp changes in the quantisation level applied to adjacent blocks of wavelet coefficients (resulting from sharp changes in the image activity of pixel blocks at corresponding positions in the original image), there can be visible artifacts generated when the images are decompressed. This can be a particular problem when a block falls at the edge of a region of high activity.
This invention provides a video data compression apparatus comprising:
means for detecting image activity values indicative of image activity for regions of an input image to be compressed;
means for filtering the detected image activity values to reduce the variation in image activity values between groups of adjacent regions of the image; and
means for compressing the regions of the image by a degree of data compression dependent on the image activity value for each region.
The invention addresses the above problem by filtering the detected activity values to avoid or at least alleviate problems of sharp changes in activity values between adjacent regions (e.g. blocks) resulting in sharp changes in the quantisation or compression of those regions of the input image.
Preferably the detecting means is operable to detect the variance of luminance values of pixels in each region of the image.
Preferably the regions comprise rectangular blocks of pixels of the input image.
Although the filtering means could be a multi-tap spatial filter, it is preferred that the filtering means is a simpler (and less processor-intensive) median filter operable to replace the activity value of each regions by the median activity value from a predetermined group of surrounding regions.
As described in the introduction, the problems of sharp changes in activity values resulting in sharp changes in image quantisation apply in particular to wavelet encoded data, and so the invention is particularly applicable to apparatus in which the frequency separating means is a wavelet frequency separator.
Preferably the compressing means comprises: means for frequency separating the regions of the input image to generate respective frequency separated image data; and means for quantising the frequency separated image data derived from each region by a quantisation scale factor dependent on the image activity value for that region.
To avoid any doubt, in the description of a preferred embodiment below, a numerically lower quantisation scale factor will lead to a harsher quantisation and so to a smaller amount of encoded data being generated. This is in fact the opposite convention to that normally quoted in MPEG literature, in which a numerically higher quantisation scale factor will lead to a harsher quantisation. The skilled man will appreciate that in either case the definition is simply a convenient convention and does not affect the function or detail of the present invention.
Preferably the apparatus comprises a multi-stage auto-quantiser for generating quantisation values for use in quantisation of the input image, each stage of the auto-quantiser other than a final stage being operable:
(i) to generate a test quantisation value in dependence on a basic quantisation value and the activity value for a current region;
(ii) to compress frequency separated image data from the current region in accordance with the test quantisation value;
(iii) to compare the resulting quantity of compressed data with a desired quantity of data; and
(iv) to increase or decrease the basic quantisation value to be used by a next stage in dependence on whether the quantity of compressed data is greater than or less than the desired quantity.
Preferably the test quantisation values are generated by the following formula:   qs  =            2      ·      AQSF              1      +              A        P            
where AQSF is a xe2x80x9cbasicxe2x80x9d quantisation value, A is an activity value, and P is a scaling constant. A feature of this function is that where the overall quantisation of the image is relatively gentle, then there is a wide variation in quantisation in dependence on the block activity values. However, where the overall quantisation of the image is harsh, then there is little variation between blocks in dependence on their activity values. The reason for the low variation between blocks at a harsh overall quantisation level is that the blocks of high activity are already harshly quantised and so there is little scope for quantising those blocks yet more harshly.
Although a quantisation value can be calculated for each region or block of the image from which an activity value is detected, it can be more convenient that a single quantisation factor is used in quantising frequency separated image data derived from a plurality of regions (e.g. a horizontal xe2x80x9cslicexe2x80x9d of the image), the single quantisation scale factor being dependent on the image activity values detected for at least one of the plurality of regions.
This invention also provides apparatus for generating quantisation values for use in quantisation of regions of an input image, the apparatus comprising a plurality of stages, each stage of the apparatus other than the final stage being operable:
(i) to generate a test quantisation value in dependence on a basic quantisation value and an activity value indicative of a degree of detail in a current region;
(ii) to compress frequency separated image data from the current region in accordance with the test quantisation value;
(iii) to compare the resulting quantity of compressed data with a desired quantity of data; and
(iv) to increase or decrease the basic quantisation value to be used by a next stage in dependence on whether the quantity of compressed data is greater than or less than the desired quantity;
the final stage being operable to generate a final quantisation value for use in quantising the image data for the current region in dependence on the basic quantisation value and the activity value indicative of a degree of detail in the current region.
This invention also provides a video data compression method comprising the steps of:
detecting image activity values indicative of image activity for regions of an input image to be compressed;
filtering the detected image activity values to reduce the variation in image activity values between groups of adjacent regions of the image; and
compressing the regions of the image by a degree of data compression dependent on the image activity value for each region.